<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8">
<title>监控参数列表</title>
<@fm.header />
<script>
function doSearch(){    
    $('#tt').datagrid('load', {    
        param: $('#param').val(),
        startTime: $('#startTime').datetimebox('getValue'),
        endTime: $('#endTime').datetimebox('getValue'),
        isExecute: $('#isExecute').combobox('getValue')
    });
}

function add(){
    showMyWindow('新建', '/monitor/param/timing/add', 400, 350);
}

function edit(){
	var row = $('#tt').datagrid('getSelected');
	if (row.isExecute != 0) {
		$.messager.alert(market.content.title, '已执行不可编辑!');
		return;
	}
    if (row){
	    showMyWindow('监控定时参数配置 | 编辑', '/monitor/param/timing/'+row.id+'/update', 400, 350);
    } else {
    	showMsg(market.content.title, market.content.tips, alert);
    }
}

function del(){
	var row = $('#tt').datagrid('getSelected');
    if (row){
	   showConfirm(market.content.title, market.content.confirm, function(){
		  $.post('/monitor/param/timing/'+row.id+'/delete', function(data) {
		  	if (data.return_code == '1') {
				top.showMsg(market.content.title, data.return_msg, alert);
				$("#tt").datagrid('reload');
				$('#tt').datagrid('clearSelections');
			} else {
				$.messager.alert(market.content.title, data.return_msg);
			}
		  });
	   });
    } else {
    	showMsg(market.content.title, market.content.tips, alert);
    }
}

function formatIsExecute(value,row,index){
	if (value==0) {
		return '未执行';
	} else {
		return '已执行';
	}
}


</script>
</head>
<body class="cmp-list-body">
<div id="tb" style="padding:3px">
    <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add();">新增</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit();">修改</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="del();">删除</a>
    
    <span>参数:</span>
    <input id="param" style="line-height:20px;border:1px solid #ccc">
    <span>执行时间:</span>
    <input type="text" class="easyui-datetimebox" id="startTime" />至
    <input type="text" class="easyui-datetimebox" id="endTime" />
    <span>是否已执行:</span>
    <select class="easyui-combobox" id="isExecute" panelHeight="auto" style="width:155px" >
    	<option value="" >全部</option>
        <option value="0" >未执行</option>
    	<option value="1" >已执行</option>
    </select>
    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="doSearch();">查询</a> 
    
</div>
<table id="tt" class="easyui-datagrid" title="监控参数列表" iconCls="icon-save" 
	url="/monitor/param/timing/listJson" toolbar="#tb" rownumbers="true" idField="id"
	singleSelect="true" pagination="true" fitColumns="true" pageSize="15" pageList="[15,30,60,80,100]"> 
    <thead>
        <tr>
            <th align="center" width="35%" field="param">参数</th>
            <th align="center" width="25%" field="executeTime">执行时间</th>
            <th align="center" width="10%" field="value">值</th>
            <th align="center" width="6%" field="isExecute" formatter="formatIsExecute">是否以执行</th>
        </tr>
    </thead>   
</table>
</body>
</html>